﻿@model WhoisClientWebSite.Models.WhoisQueryViewModel
@using System.Web.Optimization
@{
    ViewBag.Title = "Whois";
    BundleTable.Bundles.GetBundleFor("~/bundles/js").Include("~/Scripts/index.js");
}

@using (Html.BeginForm("Index", "WhoisClient", FormMethod.Get))
{
    @Html.ValidationSummary(true)

    <fieldset>
        <div class="editor-label">
            @Html.LabelFor(model => model.Query)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Query, new {autofocus=true, placeholder="ex) 'apphb.com' or '184.72.232.223'" })
            @Html.ValidationMessageFor(model => model.Query)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Server) (optional / 省略可)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Server, new { placeholder="ex) whois.arin.net" })
            @Html.ValidationMessageFor(model => model.Server)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Encoding)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(m => m.Encoding, System.Text.Encoding.GetEncodings().Select(enc => new SelectListItem { Text = enc.GetEncoding().WebName, Value = enc.GetEncoding().WebName }))
            @Html.ValidationMessageFor(model => model.Encoding)
        </div>

        <p>
            <input type="submit" value="Send Query" class="btn btn-primary btn-large" />
        </p>

        <div class="editor-label">
            @Html.LabelFor(model => model.Response)
        </div>
        <div class="response well">
        @if (Model.Response != null)
        {
            @Html.Partial("_ResponseOfQuery", Model.Response)
        }
        </div>

    </fieldset>
}
